<template>
  <div class="RequestConsultation">
    <SubtTitle
      name="申请列表"
      icon-name="operate"
      has-icon
      style="margin-bottom: 10px"
    ></SubtTitle>
    <Table :tableData="tableData" :columnList="columnList">
      <template v-slot:hzStatus="{ row }">
          <div style="display: flex; justify-content: space-around">
              <span v-if="!row.result" style="color: darkorange;">进行中</span>
              <span v-else style="color: chartreuse;">已完成</span>
          </div>
        </template>
      <template v-slot:caozuo="{ row }">
          <div style="display: flex; justify-content: space-around">
            <el-button :icon="Edit" @click="onConsulation(row)" class="hoveredi">
              进入会议
            </el-button>
          </div>
        </template>
    </Table>
    <AIRouter :key="activeRouterValue?.path"/>

  </div>
</template>

<script setup>
import { ref, reactive, toRefs, onBeforeMount, onMounted } from "vue";
import SubtTitle from "@/components/Title/subtTitle.vue";
import Table from "@/components/Table/table.vue";
import { useRouter, useRoute } from "vue-router";
import {getSendMsg} from '@/api/index.js'
import usePatientInformation from "@/store/usePatientInformation.js";
const PatientInformation = usePatientInformation();
const router = useRouter();
const route = useRoute();
const activeRouterValue = ref("");

const header = ref({
  serial: true,
});
const tableData = ref([
// {
//     category: "急会诊",
//     patName: "王五",
//     applyforName: "毛宣飞",
//     applyforReason: "病情复杂，需多科协作",
//     hzStatus: "1",
//     expertList:"周强/王五",
//     phone:"15580269802",
//   },
  
 
]);
const columnList = ref([
  { prop: "hzType", label: "类别", },
  { prop: "patName", label: "患者姓名", },
  { prop: "specialistIdFromName", label: "申请人",  },
  { prop: "sqtime", label: "申请时间",},
  { prop: "specialistIdToName", label: "受邀专家", },
  { prop: "applyMsg", label: "申请理由", },
  { prop: "hzStatus", label: "会诊状态", slot:true},
  { prop: "result", label: "诊断结果", },
  { prop: "caozuo", label: "操作", slot:true},
  
]);

onMounted(()=>{
  
  getSendMsg(JSON.parse(localStorage.getItem('user')).id).then(res=>{
    console.log(res,"222222222");
    tableData.value = res
  })
})

const onConsulation = (row)=>{
  console.log(row,"row");
  PatientInformation.patientInforList = row
  router.push('/SurgicalMonitoring')
}


</script>
<style scoped lang="scss">
.RequestConsultation {
  span {
    margin-right: 15px;
  }
  .btn {
    color: #77d3ce;
    cursor: pointer;
  }
}
</style>

